<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        {
            let a = 10 ; 
            console.log(a);
            console.log(window.a);      //let不会挂载在window上
        }
        {
            var  b = 20 ; 
            let c = 10 ;
            console.log(b,c);           //let申明的变量只在该块级作用域起效果
        }
        console.log(b,c);               //会报错c is not defined
        {
            let a = 10 ; 
            let a = 20 ;                //会报错 Identifier 'a' has already been declared
            //let不能重复申明
        }
        {
            let m = 10 ;
            var m = 10 ;        //会报错 Identifier 'a' has already been declared
            //let没有申明前置，var有申明前置，所以m已经被var申明过后，不能被let重复申明
        }
    </script>
</body>
</html>